<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<%

' if not cf(session("aaPostFlag"),1) then call ShowError(2)

'获取提交查询的参数
tx_search=trim(SafeRequest("tx_search",0))
choice=trim(SafeRequest("choice",0))
xls_id=trim(SafeRequest("xls_id",1))

if tx_search="" then 
	response.write("请输入查询内容<br />")
	response.end
end if
if choice="tele_num" then
	sql_fee="select * from fee where fee_yhhm='"&tx_search&"' and fee_xls="&xls_id
	'response.write(sql_fee)
	QueryFee(sql_fee)
	sql_report="select * from report where report_tele='"&tx_search&"' and report_xls="&xls_id
elseif choice="dept_name" then
	sql_report="select * from report where report_dept='"&tx_search&"' and report_xls="&xls_id
elseif choice="empe_name" then
	sql_report="select * from report where report_empe='"&tx_search&"' and report_xls="&xls_id
else
	response.end
end if
QueryReport(sql_report)



function QueryFee(sql)
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open sql,conn,1,1
	if not rs.eof then
%>
账单详细：
	<table class="full">
		<thead>
			<tr>
				<th scope="col">序号</th>
<%
		for i=2 to rs.fields.count-1
%>
				<th scope="col"><%=d.item(rs.fields(i).name)%></th>
<%
		next	
%>
				</tr>
		</thead>
		<tbody>
<%
	do while not rs.eof
%>
			<tr>
				<th class="sub" scope="row"><%=rs.AbsolutePosition%></th>
<%
			for i=2 to rs.fields.count-1
%>
				<td><%=rs.fields(i).value%></td>
<%
			next
%>
			</tr>
<%
	
		rs.movenext
	loop
	rs.close
	set rs=nothing
%>
		</tbody>
	</table>
<%
	else
		response.write("找不到账单数据<br />")
	end if

end function
function QueryReport(sql)
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.Open sql,conn,1,1
	if not rs.eof then
%>
报表详细：
	<table class="full">
		<thead>
			<tr>
				<th scope="col">序号</th>
				<th scope="col">部门</th>
				<th scope="col">名字</th>
				<th scope="col">电话</th>
				<th scope="col">权重</th>
				<th scope="col">费用</th>
			</tr>
		</thead>
		<tbody>
<%
	do while not rs.eof
%>
			<tr>
				<th class="sub" scope="row"><%=rs.AbsolutePosition%></th>
				<td><%=rs("report_dept")%></td>
				<td><%=rs("report_empe")%></td>
				<td><%=rs("report_tele")%></td>
				<td><%=FormatPercent(rs("report_weight"))%></td>
				<td><%=FormatCurrency(ccur(rs("report_fee")*rs("report_weight")))%></td>
			</tr>
<%
		sum_all=sum_all+ccur(rs("report_fee")*rs("report_weight"))
		rs.movenext
	loop
	rs.close
	set rs=nothing
%>
			<tr>
				<th>合计</th>
				<th></th>
				<th></th>
				<th></th>
				<th></th>
				<th><%=FormatCurrency(ccur(sum_all))%></th>
			</tr>
		</tbody>
	</table>
<%
	else
		response.write("找不到报表数据<br />")
	end if

end function

%>


<!--#include file="lib/connclose.asp"-->

